﻿using System.Collections.Generic;
using NExt.util;
using NExt.Core.Model.Base;

namespace NExt.data
{
    public class Store : Store<StoreEvents>
    {
    }

    public abstract class Store<TEvents>: Observable<TEvents>
        where TEvents : StoreEvents, new()
    {
        protected Store()
        {
            data = new List<object>();
        }

        public object autoLoad { get; set; } //TODO
        public object baseParams { get; set; }
        public IList<object> data { get; set; }
        public DataProxy proxy { get; set; }
        public bool? pruneModifiedRecords { get; set; }
        public DataReader reader { get; set; }
        public bool? remoteSort { get; set; }
        public object sortInfo { get; set; }
        public string storeId { get; set; }
        public string url { get; set; }
    }

    public class StoreEvents : ObservableEvents
    {
        public IScript add { get; set; }
        public IScript beforeload { get; set; }
        public IScript clear { get; set; }
        public IScript datachanged { get; set; }
        public IScript load { get; set; }
        public IScript loadexception { get; set; }
        public IScript metachange { get; set; }
        public IScript remove { get; set; }
        public IScript update { get; set; }
    }
}
